import { util } from "utils";
enum PayPlatform {
    // app
    App = "App",
    // 小程序
    Miniprogram = "Miniprogram",
    // 公众号
    OfficialAccount = "OfficialAccount",
}

// 获取当前的平台
function getPayPlatform(value: string | undefined | null): PayPlatform | null {
    if (util.nilValue(value)) {
        return null;
    }
    const match = Object.values(PayPlatform).find((platform) => platform === value);
    return match ?? null;
}

export { PayPlatform, getPayPlatform };
